import 'package:flutter/material.dart';
import 'package:top_foundation/utils/theme/button.dart';

import '../../helper/utils/util.dart';
import 'index.dart';

class ButtonPage extends GetView<ButtonController> {
  const ButtonPage({Key? key}) : super(key: key);

  // 主视图
  Widget _buildView() {
    return ListView(
      children: [
        IButton.create(onPressed: () {}),
        IButton.icon(
            onPressed: () {},
            icon: Icon(Icons.add),
            backgroundColor: Colors.amber),
        IButton.text(
          onPressed: () {},
          text: '点击我',
          backgroundColor: Colors.red,
          height: 80,
          alignment: Alignment.center,
          borderRadius: BorderRadius.circular(20),
        ),
        IButton.image(
            onPressed: () {},
            // iconHeight: 80,
            url:
                'https://pics1.baidu.com/feed/f31fbe096b63f62443c40597b7340df51b4ca302.jpeg@f_auto?token=6f7f28de859db4b533e240a84ca356c7'),
        IButton.create(
            onPressed: () {},
            child: IButtonContent(
              text: '文字',
              icon: Icons.add_a_photo,
              contentStyle: IButtonContentStyle.top_icon_bottom_text,
              spacing: 50,
            )),
      ],
    );
  }

  @override
  Widget build(BuildContext context) {
    return GetBuilder<ButtonController>(
      builder: (_) {
        return Scaffold(
          appBar: AppBar(title: const Text("button")),
          body: SafeArea(
            child: _buildView(),
          ),
        );
      },
    );
  }
}
